#include "choosedlg.h"
#include <QVBoxLayout>

ChooseDlg::ChooseDlg()
{
    QVBoxLayout* lay = new QVBoxLayout(this);
    lay->addWidget(buttons[0] = new QPushButton("人机对弈(入门级)"));
    lay->addWidget(buttons[1] = new QPushButton("人机对弈(初级)"));
    lay->addWidget(buttons[2] = new QPushButton("人机对弈(中级)"));
    lay->addWidget(buttons[3] = new QPushButton("人机对弈(高级)"));
    lay->addWidget(buttons[4] = new QPushButton("双人对弈(单机)"));
    lay->addWidget(buttons[5] = new QPushButton("网络对弈(服务端)"));
    lay->addWidget(buttons[6] = new QPushButton("网络对弈(客户端)"));

    for (int i = 0; i < 7; i++)
        connect(buttons[i], SIGNAL(clicked()), this, SLOT(slotClicked()));
}

void ChooseDlg::slotClicked()
{
    for(int i=0; i < 7; i++)
        if(buttons[i] == sender())
        {
            this->selected = i;
            break;
        }
    accept();
}
